package com.heima.feign.behavior;

import com.heima.behavior.entity.ApBehaviorEntry;
import com.heima.behavior.entity.ApFollowBehavior;
import com.heima.behavior.entity.ApLikesBehavior;
import com.heima.behavior.entity.ApUnlikesBehavior;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import com.heima.behavior.dto.ReadBehaviorDto;
import com.heima.common.dto.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@FeignClient("leadnews-behavior")
public interface BehaviorFeign {

    /**
     * 根据用户ID和设备ID获取实体
     */
    @GetMapping("/api/v1/behavior_entry")
    public ApBehaviorEntry findEntryByUesridAndEqid(@RequestParam("userId") Integer userId, @RequestParam("equipmentId") String equipmentId);


    /**
     * 根据实体ID查询是否关注
     *
     * @param entryId
     * @return
     */
    @GetMapping("/api/v1/follow_behavior/{entryId}")
    public ApFollowBehavior findFollowBehavior(@PathVariable("entryId") Integer entryId);


    /**
     * 根据文章ID和设备ID查询是否点赞
     *
     * @param articleId
     * @param entryId
     * @return
     */
    @GetMapping("/api/v1/likes_behavior")
    public ApLikesBehavior findApLikesBehavior(@RequestParam("articleId") Integer articleId, @RequestParam("entryId") Integer entryId);

    /**
     * 根据文章ID和设备ID查询是否喜欢
     *
     * @param articleId
     * @param entryId
     * @return
     */
    @GetMapping("/api/v1/unlikes_behavior")
    public ApUnlikesBehavior findApUnlikesBehavior(@RequestParam("articleId") Integer articleId, @RequestParam("entryId") Integer entryId);


    /**
     * 用户阅读行为记录
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/read_behavior")
    public ResponseResult read(@RequestBody ReadBehaviorDto dto);


}

